<template>
  <div>

    <!-- 面包屑导航条 -->
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/index' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>工艺管理</el-breadcrumb-item>
      <el-breadcrumb-item>工艺明细</el-breadcrumb-item>
    </el-breadcrumb>


    <el-card class="box-card">
      <el-button @click="resetForm">返回</el-button>

      <el-table
        :data="ruleForm"
        style="width: 100%">
        <el-table-column
          label="编号"
          width="180">
          <template slot-scope="scope">

            <a :href="'http://localhost:8080/order-pic/preview/'+itemId+'/'+scope.row.code" target="_blank">{{scope.row.code}}</a>

          </template>
        </el-table-column>
        <el-table-column prop="name" label="零件名称" width="180">
          <template slot-scope="scope">
           {{scope.row.name}}
          </template>
        </el-table-column>
        <el-table-column
          prop="num"
          label="生产数量">
          <template slot-scope="scope">
            {{scope.row.num}}
          </template>
        </el-table-column>
        <el-table-column
          prop="num"
          label="操作">
          <template slot-scope="scope">



                <el-button type="primary" @click="detail(scope.row.id)">制作</el-button>
                <el-button type="primary" @click="lookDetail(scope.row.id)">查看</el-button>

          </template>
        </el-table-column>
      </el-table>

      <el-row style="left: 500px">
       <!-- <el-button @click="resetForm('linkForm')">重置</el-button>
        <el-button @click="saveOrder" type="primary">保存</el-button>-->
      </el-row>

    </el-card>

  </div>
</template>

<script>
  export default {
    name: 'GyDetail',
    data(){
      return{
        ruleForm:[],
        itemId:''
      }
    },
    methods:{
      //返回
      resetForm:function(){
        this.$router.push({path:'/gy'})
      },
      getById:function (id) {
        this.$http.get("/gy/getById/"+id).then((res)=>{
          this.ruleForm=res.data.result;
          console.info(this.ruleForm);
        });
      },
      detail:function (id) {
          this.$router.push({path:'/ProcessWork?id='+id})
      },
      //回显制作
      lookDetail:function (id) {
        this.$router.push({path:'/lookDetail?id='+id})
      }
    },
    mounted () {
      this.getById(this.$route.query.id);
      this.itemId=sessionStorage.getItem("itemId");
    }
  }
</script>

<style scoped>

</style>
